

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Introduction &mdash; AML v0.4.3 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.4.3',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="AML v0.4.3 documentation" href="index.html" />
    <link rel="next" title="aml — Simple interface to the AML Markup Language" href="aml.html" />
    <link rel="prev" title="AML documentation contents" href="contents.html" /> 
  </head>
  <body>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="aml.html" title="aml — Simple interface to the AML Markup Language"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="contents.html" title="AML documentation contents"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">AML home</a>&nbsp;|&nbsp;</li>
        <li><a href="contents.html">Documentation</a>&raquo;</li>
 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="introduction">
<h1>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h1>
<div class="section" id="what-is-aml">
<h2>What is AML?<a class="headerlink" href="#what-is-aml" title="Permalink to this headline">¶</a></h2>
<p>AML is a simple markup language for representing hierarchically structured data
in form of text data. It resembles the XML structure, but the syntax is based
on Lisp. Almost everything you can do with XML you can do with AML as well.</p>
<p>An AML document consist of text characters. In the simplest case ASCII, but
any other encodings are also possible.</p>
</div>
<div class="section" id="structure-of-an-aml-document">
<h2>Structure of an AML document<a class="headerlink" href="#structure-of-an-aml-document" title="Permalink to this headline">¶</a></h2>
<p>An example for an AML document:</p>
<div class="highlight-text"><div class="highlight"><pre>(lists
    (list
        (name &quot;test&quot;)
        (item
            (key &quot;one&quot;)
            (value &quot;hello world&quot;))
        (item
            (key &quot;two&quot;)
            (value 42))
        (item
            (key &quot;three&quot;)
            (value 23.5))))
</pre></div>
</div>
<p>In XML it would look like this:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;lists&gt;</span>
    <span class="nt">&lt;list</span> <span class="na">name=</span><span class="s">&quot;test&quot;</span><span class="nt">&gt;</span>
        <span class="nt">&lt;item</span> <span class="na">key=</span><span class="s">&quot;one&quot;</span> <span class="na">value=</span><span class="s">&quot;hello world&quot;</span> <span class="nt">/&gt;</span>
        <span class="nt">&lt;item</span> <span class="na">key=</span><span class="s">&quot;two&quot;</span> <span class="na">value=</span><span class="s">&quot;42&quot;</span> <span class="nt">/&gt;</span>
        <span class="nt">&lt;item</span> <span class="na">key=</span><span class="s">&quot;three&quot;</span> <span class="na">value=</span><span class="s">&quot;23.5&quot;</span> <span class="nt">/&gt;</span>
    <span class="nt">&lt;/list&gt;</span>
<span class="nt">&lt;/lists&gt;</span>
</pre></div>
</div>
<p>Names are in every AML document. Every name must be a valid AML identifier. A
valid identifier can consist of any character of the english alphabet, digits
and the underscore <tt class="docutils literal"><span class="pre">_</span></tt> and mustn’t start with a digit.</p>
<p>Valid identifiers are:</p>
<div class="highlight-text"><div class="highlight"><pre>name
hello_world
sinn_42
_3
_foo
bar_
</pre></div>
</div>
<p>Invalid identifiers are:</p>
<div class="highlight-text"><div class="highlight"><pre>42
3_names
hello world
</pre></div>
</div>
<p>AML documents consists of nodes. The name of the node must be a valid AML
identifier. In this case <tt class="docutils literal"><span class="pre">node</span></tt> is the name of the node:</p>
<div class="highlight-text"><div class="highlight"><pre>(node)
</pre></div>
</div>
<p>Nodes can have attributes. An attribute consists of a name and a value
<tt class="docutils literal"><span class="pre">(name</span> <span class="pre">value)</span></tt>. The name must be a valid AML identifier. The value can be a
string, integer, float, boolean or none:</p>
<div class="highlight-text"><div class="highlight"><pre>(node
    (string &quot;hello world&quot;)
    (integer 42)
    (float 23.5)
    (float2 2.35e1)
    (boolean_true #t)
    (boolean_false #f)
    (none #n))
</pre></div>
</div>
<p>Nodes can also have children:</p>
<div class="highlight-text"><div class="highlight"><pre>(root
    (child)
    (another_child))
</pre></div>
</div>
<p>Remember, every document can have only one root node like XML. So the following
example is no valid AML:</p>
<div class="highlight-text"><div class="highlight"><pre>(root
    (child))
(i_am_not_a_valid_document)
</pre></div>
</div>
<p>There is one big difference in the structure of AML and XML. XML nodes can
have a value:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;item&gt;</span>value<span class="nt">&lt;/item&gt;</span>
</pre></div>
</div>
<p>AML nodes can&#8217;t have a value.  If you need values you can use attributes
instead:</p>
<div class="highlight-text"><div class="highlight"><pre>(item
    (value &quot;value&quot;))
</pre></div>
</div>
</div>
<div class="section" id="string-values">
<h2>String values<a class="headerlink" href="#string-values" title="Permalink to this headline">¶</a></h2>
<p>String values can contain escape sequences. AML knows the usual escape
sequences like <tt class="docutils literal"><span class="pre">\n</span></tt> and <tt class="docutils literal"><span class="pre">\t</span></tt>. To write a backslash (<tt class="docutils literal"><span class="pre">\</span></tt>), you have to
write it twice: <tt class="docutils literal"><span class="pre">\\</span></tt> becomes <tt class="docutils literal"><span class="pre">\</span></tt>.</p>
<p>You can use <tt class="docutils literal"><span class="pre">'</span></tt> or <tt class="docutils literal"><span class="pre">&quot;</span></tt> to mark a string, there is no difference. If you
want to use a <tt class="docutils literal"><span class="pre">'</span></tt> inside of a string marked with <tt class="docutils literal"><span class="pre">'</span></tt> you need to escape it
with a backslash <tt class="docutils literal"><span class="pre">\'</span></tt>. Inside a string marked with <tt class="docutils literal"><span class="pre">&quot;</span></tt> you need to escape
a <tt class="docutils literal"><span class="pre">&quot;</span></tt> with a backslash <tt class="docutils literal"><span class="pre">\&quot;</span></tt>.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Introduction</a><ul>
<li><a class="reference internal" href="#what-is-aml">What is AML?</a></li>
<li><a class="reference internal" href="#structure-of-an-aml-document">Structure of an AML document</a></li>
<li><a class="reference internal" href="#string-values">String values</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="contents.html"
                        title="previous chapter">AML documentation contents</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="aml.html"
                        title="next chapter"><tt class="docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal docutils literal"><span class="pre">aml</span></tt> &#8212; Simple interface to the AML Markup Language</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/intro.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="aml.html" title="aml — Simple interface to the AML Markup Language"
             >next</a> |</li>
        <li class="right" >
          <a href="contents.html" title="AML documentation contents"
             >previous</a> |</li>
        <li><a href="index.html">AML home</a>&nbsp;|&nbsp;</li>
        <li><a href="contents.html">Documentation</a>&raquo;</li>
 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009, Bjoern Schulz.
      Last updated on Oct 31, 2010.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>